<?php if(!defined('SIDELOADED')) { echo 'Direct access is not allowed.'; }

/**
 * Create a local anchor-tag.
 * @param string $link The link to which the anchor should point.
 * @param string $name The name of the anchor.
 * @return string The anchor.
 */
function lanchor($link, $name = null) {
  global $config;
  
  if(isset($name)) {
    
    if(strpos($link, $config['router']['extension']) !== false) {
     
      return '<a href="' . URL . $link . '">' . $name . '</a>';
      
    } else {
    
      return '<a href="' . URL . $link . '.html">' . $name . '</a>';
      
    }
    
  } else {
    
    if(strpos($link, $config['router']['extension']) !== false) {
     
      return '<a href="' . URL . $link . '">' . $link . '</a>';
      
    } else {
    
      return '<a href="' . URL . $link . '.html">' . $link . '</a>';
      
    }
    
  }
  
}